home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / AMScen_0_9.lha / AMScen / build2.m < prev    next >
Text File  |  1995-01-21  |  50KB  |  1,907 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1995 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * build2.m - the mouse/graphics builder interface.
  9.  */
  10.  
  11. private tp_build2 CreateTable().
  12. use tp_build2
  13.  
  14. define tp_build2 p_pCurrentTable CreateTableProp().
  15. define tp_build2 p_pIdleSave CreateActionProp().
  16. define tp_build2 p_pButtonEraser CreateActionProp().
  17. define tp_build2 p_pHandlerSave1 CreateActionProp().
  18. define tp_build2 p_pHandlerSave2 CreateActionProp().
  19. define tp_build2 p_pHandlerSave3 CreateActionProp().
  20. define tp_build2 p_pHandlerSave4 CreateActionProp().
  21. define tp_build2 p_pHandlerSave5 CreateActionProp().
  22. define tp_build2 p_pHandlerSave6 CreateActionProp().
  23. define tp_build2 p_pDirectionNext CreateActionProp().
  24. define tp_build2 p_pDirectionWhat CreateStringProp().
  25. define tp_build2 p_pDirectionRoom1 CreateBoolProp().
  26. define tp_build2 p_pSelectedDir CreateIntProp().
  27. define tp_build2 p_pFirstDir CreateIntProp().
  28. define tp_build2 p_pRoomKind CreateIntProp().
  29. define tp_build2 p_pDescKind CreateIntProp().
  30.     define tp_build2 DESC_DIRDESC     0.
  31.     define tp_build2 DESC_DIRMESSAGE  1.
  32.     define tp_build2 DESC_DIROMESSAGE 2.
  33.     define tp_build2 DESC_DIREMESSAGE 3.
  34. define tp_build2 p_pSelectedPen CreateIntProp().
  35. define tp_build2 DummyGrammar CreateGrammar().
  36. define tp_build2 p_pSelectedObject CreateThingProp().
  37.  
  38. define tp_build2 p_pCurrentObject CreateThingProp().
  39. define tp_build2 p_pSelectedSymbol CreateStringProp().
  40.  
  41. define tp_build2 BUILD_BUTTON    17.
  42.  
  43. define tp_build2 EXIT_BUTTON    17.    /* used several places */
  44. define tp_build2 MORE_BUTTON    18.    /* used several places */
  45.  
  46. define tp_build2 ROOM_BUTTON    19.
  47. define tp_build2 OBJECT_BUTTON    20.
  48. define tp_build2 POOF_BUTTON    21.
  49. define tp_build2 SYMBOLHERE_BUTTON 22.
  50. define tp_build2 TABLES_BUTTON    23.
  51.  
  52. /* EXIT_BUTTON = 17 */
  53. define tp_build2 NEW_BUTTON    19.    /* used elsewhere also */
  54. define tp_build2 SELECT_BUTTON    20.    /* used elsewhere also */
  55. define tp_build2 USE_BUTTON    21.    /* used elsewhere also */
  56. define tp_build2 UNUSE_BUTTON    22.
  57. define tp_build2 SYMBOLS_BUTTON 23.
  58. define tp_build2 DESCRIBE_BUTTON 24.
  59.  
  60. /* EXIT_BUTTON = 17 */
  61. /* MORE_BUTTON = 18 */
  62. /* NEW_BUTTON = 19 */
  63. define tp_build2 NAME_BUTTON    21.    /* used elsewhere also */
  64. define tp_build2 DESC_BUTTON    22.    /* used elsewhere also */
  65. define tp_build2 AUTO_BUTTON    23.
  66. define tp_build2 LINK_BUTTON    24.
  67. define tp_build2 UNLINK_BUTTON    25.
  68. define tp_build2 SAME_BUTTON    26.
  69. define tp_build2 HIDE_BUTTON    27.
  70. define tp_build2 SHOP_BUTTON    28.
  71. define tp_build2 SELL_BUTTON    29.
  72. define tp_build2 BANK_BUTTON    30.
  73.  
  74. /* EXIT_BUTTON = 17 */
  75. /* MORE_BUTTON = 18 */
  76. define tp_build2 DARK_BUTTON    19.
  77. define tp_build2 LOCK_BUTTON    20.
  78. define tp_build2 READONLY_BUTTON 21.
  79. define tp_build2 WIZARD_BUTTON    22.
  80. define tp_build2 PUBLIC_BUTTON    23.
  81. define tp_build2 DD_BUTTON    24.
  82. define tp_build2 DM_BUTTON    25.
  83. define tp_build2 OM_BUTTON    26.
  84. define tp_build2 EM_BUTTON    27.
  85.  
  86. /* EXIT_BUTTON = 17 */
  87. define tp_build2 HELP_BUTTON    18.
  88.  
  89. define tp_build2 INDOORS_BUTTON 17.
  90. define tp_build2 OUTDOORS_BUTTON 18.
  91. define tp_build2 FOREST_BUTTON    19.
  92. define tp_build2 FIELD_BUTTON    20.
  93. define tp_build2 PATH_BUTTON    21.
  94. define tp_build2 ROAD_BUTTON    22.
  95. define tp_build2 SIDEWALK_BUTTON 23.
  96. define tp_build2 PARK_BUTTON    24.
  97. define tp_build2 TUNNEL_BUTTON    25.
  98.  
  99. /* EXIT_BUTTON = 17 */
  100. define tp_build2 AUTO_KIND_BUTTON    18.
  101. define tp_build2 AUTO_BGNDPEN_BUTTON    19.
  102. define tp_build2 AUTO_FGNDPEN_BUTTON    20.
  103. define tp_build2 AUTO_EDGEPEN_BUTTON    21.
  104. define tp_build2 AUTO_DOORPEN_BUTTON    22.
  105. define tp_build2 AUTO_NAME1_BUTTON    23.
  106. define tp_build2 AUTO_NAME2_BUTTON    24.
  107.  
  108. /* EXIT_BUTTON = 17 */
  109. define tp_build2 AUTO_ROAD_BUTTON    18.
  110. define tp_build2 AUTO_PATH_BUTTON    19.
  111. define tp_build2 AUTO_HALLROOM_BUTTON    20.
  112. define tp_build2 AUTO_DOORROOM_BUTTON    21.
  113. define tp_build2 AUTO_HALLWAY_BUTTON    22.
  114. define tp_build2 AUTO_OPENAREA_BUTTON    23.
  115. define tp_build2 AUTO_TUNNEL_BUTTON    24.
  116. define tp_build2 AUTO_CHAMBER_BUTTON    25.
  117.  
  118. /* EXIT_BUTTON = 17 */
  119. /* NEW_BUTTON = 19 */
  120. /* SELECT_BUTTON = 20 */
  121. /* DESC_BUTTON = 22 */
  122. /* NAME_BUTTON = 21 */
  123. define tp_build2 GET_BUTTON    23.
  124. define tp_build2 ACT_BUTTON    24.
  125. define tp_build2 CONTAINER_BUTTON 25.
  126. define tp_build2 LIGHT_BUTTON    26.
  127. define tp_build2 INVIS_BUTTON    27.
  128. define tp_build2 POS_BUTTON    28.
  129. define tp_build2 ACTWORD_BUTTON 29.
  130. define tp_build2 ACTSTRING_BUTTON 30.
  131.  
  132. /* EXIT_BUTTON = 17 */
  133. define tp_build2 SIT_IN_BUTTON    18.
  134. define tp_build2 SIT_ON_BUTTON    19.
  135. define tp_build2 LIE_IN_BUTTON    20.
  136. define tp_build2 LIE_ON_BUTTON    21.
  137. define tp_build2 STAND_IN_BUTTON 22.
  138. define tp_build2 STAND_ON_BUTTON 23.
  139.  
  140. /* EXIT_BUTTON = 17 */
  141. /* MORE_BUTTON = 18 */
  142. define tp_build2 PLAY_BUTTON    19.
  143. define tp_build2 ERASE_BUTTON    20.
  144. define tp_build2 EAT_BUTTON    22.
  145. /* GET_BUTTON = 23 */
  146. define tp_build2 READ_BUTTON    24.
  147. define tp_build2 OPEN_BUTTON    25.
  148. define tp_build2 CLOSE_BUTTON    26.
  149. define tp_build2 TURN_BUTTON    27.
  150. define tp_build2 LIFT_BUTTON    28.
  151. /* USE_BUTTON = 21 */
  152.  
  153. /* EXIT_BUTTON = 17 */
  154. /* MORE_BUTTON = 18 */
  155. define tp_build2 ACTIVATE_BUTTON 19.
  156. define tp_build2 LISTEN_BUTTON    20.
  157. define tp_build2 WEAR_BUTTON    21.
  158. define tp_build2 PUSH_BUTTON    22.
  159. define tp_build2 PULL_BUTTON    23.
  160. define tp_build2 LOWER_BUTTON    24.
  161. define tp_build2 TOUCH_BUTTON    25.
  162. define tp_build2 SMELL_BUTTON    26.
  163. define tp_build2 UNLOCK_BUTTON    27.
  164.  
  165. /*
  166.  * addBuildButton - add the biuld button.
  167.  */
  168.  
  169. define tp_build2 proc utility addBuildButton()void:
  170.  
  171.     AddButton(162, 31, BUILD_BUTTON, "@");
  172. corp;
  173.  
  174. /*
  175.  * eraseBuildButton - erase the build button.
  176.  */
  177.  
  178. define tp_build2 proc utility eraseBuildButton()void:
  179.  
  180.     EraseButton(BUILD_BUTTON);
  181. corp;
  182.  
  183. /*
  184.  * addTopButtons - add the top-level build buttons.
  185.  */
  186.  
  187. define tp_build2 ADD_TOP_BUTTONS_ID NextEffectId().
  188. define tp_build2 proc utility addTopButtons()void:
  189.  
  190.     if not KnowsEffect(nil, ADD_TOP_BUTTONS_ID) then
  191.     DefineEffect(nil, ADD_TOP_BUTTONS_ID);
  192.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  193.     AddButton(212, 32, ROOM_BUTTON, "Room");
  194.     AddButton(263, 32, OBJECT_BUTTON, "Object");
  195.     AddButton(161, 49, POOF_BUTTON, "Poof");
  196.     AddButton(223, 49, SYMBOLHERE_BUTTON, "Symbol Here");
  197.     AddButton(161, 66, TABLES_BUTTON, "Tables");
  198.     EndEffect();
  199.     fi;
  200.     CallEffect(nil, ADD_TOP_BUTTONS_ID);
  201. corp;
  202.  
  203. /*
  204.  * addTableButtons - add the buttons for table operations.
  205.  */
  206.  
  207. define tp_build2 ADD_TABLE_BUTTONS_ID NextEffectId().
  208. define tp_build2 proc utility addTableButtons()void:
  209.  
  210.     if not KnowsEffect(nil, ADD_TABLE_BUTTONS_ID) then
  211.     DefineEffect(nil, ADD_TABLE_BUTTONS_ID);
  212.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  213.     AddButton(216, 32, NEW_BUTTON, "New");
  214.     AddButton(263, 32, SELECT_BUTTON, "Select");
  215.     AddButton(161, 49, USE_BUTTON, "Use");
  216.     AddButton(271, 49, UNUSE_BUTTON, "UnUse");
  217.     AddButton(161, 66, SYMBOLS_BUTTON, "Symbols");
  218.     AddButton(247, 66, DESCRIBE_BUTTON, "Describe");
  219.     EndEffect();
  220.     fi;
  221.     CallEffect(nil, ADD_TABLE_BUTTONS_ID);
  222. corp;
  223.  
  224. /*
  225.  * addRoomButtons - add the buttons for room building.
  226.  */
  227.  
  228. define tp_build2 ADD_ROOM_BUTTONS1_ID NextEffectId().
  229. define tp_build2 proc utility addRoomButtons1()void:
  230.  
  231.     if not KnowsEffect(nil, ADD_ROOM_BUTTONS1_ID) then
  232.     DefineEffect(nil, ADD_ROOM_BUTTONS1_ID);
  233.     AddButton(160, 32, EXIT_BUTTON, "EXIT");
  234.     AddButton(280, 32, MORE_BUTTON, "MORE");
  235.     AddButton(160, 49, NEW_BUTTON, "New");
  236.     AddButton(208, 49, LINK_BUTTON, "Link");
  237.     AddButton(264, 49, UNLINK_BUTTON, "Unlink");
  238.     AddButton(160, 66, SAME_BUTTON, "Same");
  239.     AddButton(200, 66, HIDE_BUTTON, "Hide");
  240.     AddButton(240, 66, SHOP_BUTTON, "Shop");
  241.     AddButton(280, 66, SELL_BUTTON, "Sell");
  242.     AddButton(160, 83, BANK_BUTTON, "Bank");
  243.     AddButton(200, 83, NAME_BUTTON, "Name");
  244.     AddButton(240, 83, DESC_BUTTON, "Desc");
  245.     AddButton(280, 83, AUTO_BUTTON, "Auto");
  246.     EndEffect();
  247.     fi;
  248.     CallEffect(nil, ADD_ROOM_BUTTONS1_ID);
  249. corp;
  250.  
  251. define tp_build2 ADD_ROOM_BUTTONS2_ID NextEffectId().
  252. define tp_build2 proc utility addRoomButtons2()void:
  253.  
  254.     if not KnowsEffect(nil, ADD_ROOM_BUTTONS2_ID) then
  255.     DefineEffect(nil, ADD_ROOM_BUTTONS2_ID);
  256.     AddButton(160, 32, EXIT_BUTTON, "EXIT");
  257.     AddButton(280, 32, MORE_BUTTON, "MORE");
  258.     AddButton(160, 49, DARK_BUTTON, "Dark");
  259.     AddButton(204, 49, LOCK_BUTTON, "Lock");
  260.     AddButton(248, 49, READONLY_BUTTON, "Readonly");
  261.     AddButton(160, 66, WIZARD_BUTTON, "Wizard");
  262.     AddButton(264, 66, PUBLIC_BUTTON, "Public");
  263.     AddButton(160, 83, DD_BUTTON, "DD");
  264.     AddButton(205, 83, DM_BUTTON, "DM");
  265.     AddButton(251, 83, OM_BUTTON, "OM");
  266.     AddButton(296, 83, EM_BUTTON, "EM");
  267.     EndEffect();
  268.     fi;
  269.     CallEffect(nil, ADD_ROOM_BUTTONS2_ID);
  270. corp;
  271.  
  272. /*
  273.  * addDirButtons - add the buttons for getting a direction.
  274.  */
  275.  
  276. define tp_build2 proc utility addDirButtons()void:
  277.  
  278.     AddDirectionButtons();
  279.     AddButton(187, 82, EXIT_BUTTON, "EXIT");
  280.     AddButton(253, 82, HELP_BUTTON, "HELP");
  281. corp;
  282.  
  283. /*
  284.  * eraseDirButtons - erase the buttons for getting a direction.
  285.  */
  286.  
  287. define tp_build2 proc utility eraseDirButtons()void:
  288.  
  289.     EraseDirectionButtons();
  290.     EraseButton(HELP_BUTTON);
  291.     EraseButton(EXIT_BUTTON);
  292. corp;
  293.  
  294. /*
  295.  * addRoomKindButtons - add the new room kind buttons.
  296.  */
  297.  
  298. define tp_build2 ADD_ROOM_KIND_BUTTONS_ID NextEffectId().
  299. define tp_build2 proc utility addRoomKindButtons()void:
  300.  
  301.     if not KnowsEffect(nil, ADD_ROOM_KIND_BUTTONS_ID) then
  302.     DefineEffect(nil, ADD_ROOM_KIND_BUTTONS_ID);
  303.     AddButton(161, 32, INDOORS_BUTTON, "Indoors");
  304.     AddButton(247, 32, OUTDOORS_BUTTON, "Outdoors");
  305.     AddButton(161, 49, FOREST_BUTTON, "Forest");
  306.     AddButton(224, 49, FIELD_BUTTON, "Field");
  307.     AddButton(279, 49, PATH_BUTTON, "Path");
  308.     AddButton(161, 66, ROAD_BUTTON, "Road");
  309.     AddButton(204, 66, SIDEWALK_BUTTON, "Sidewalk");
  310.     AddButton(279, 66, PARK_BUTTON, "Park");
  311.     AddButton(161, 83, TUNNEL_BUTTON, "Tunnel");
  312.     EndEffect();
  313.     fi;
  314.     CallEffect(nil, ADD_ROOM_KIND_BUTTONS_ID);
  315. corp;
  316.  
  317. /*
  318.  * addAutoButtons - add the autographics buttons.
  319.  */
  320.  
  321. define tp_build2 ADD_AUTO_BUTTONS NextEffectId().
  322. define tp_build2 proc utility addAutoButtons()void:
  323.  
  324.     if not KnowsEffect(nil, ADD_AUTO_BUTTONS) then
  325.     DefineEffect(nil, ADD_AUTO_BUTTONS);
  326.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  327.     AddButton(279, 32, AUTO_KIND_BUTTON, "Kind");
  328.     AddButton(161, 49, AUTO_BGNDPEN_BUTTON, "Bgnd Pen");
  329.     AddButton(247, 49, AUTO_FGNDPEN_BUTTON, "Fgnd Pen");
  330.     AddButton(161, 66, AUTO_EDGEPEN_BUTTON, "Edge Pen");
  331.     AddButton(247, 66, AUTO_DOORPEN_BUTTON, "Door Pen");
  332.     AddButton(161, 83, AUTO_NAME1_BUTTON, "Name1");
  333.     AddButton(271, 83, AUTO_NAME2_BUTTON, "Name2");
  334.     EndEffect();
  335.     fi;
  336.     CallEffect(nil, ADD_AUTO_BUTTONS);
  337. corp;
  338.  
  339. /*
  340.  * addAutoKindButtons - add the autographics kind buttons.
  341.  */
  342.  
  343. define tp_build2 ADD_AUTO_KIND_BUTTONS_ID NextEffectId().
  344. define tp_build2 proc utility addAutoKindButtons()void:
  345.  
  346.     if not KnowsEffect(nil, ADD_AUTO_KIND_BUTTONS_ID) then
  347.     DefineEffect(nil, ADD_AUTO_KIND_BUTTONS_ID);
  348.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  349.     AddButton(220, 32, AUTO_ROAD_BUTTON, "Road");
  350.     AddButton(279, 32, AUTO_PATH_BUTTON, "Path");
  351.     AddButton(161, 49, AUTO_HALLROOM_BUTTON, "HallRoom");
  352.     AddButton(247, 49, AUTO_DOORROOM_BUTTON, "DoorRoom");
  353.     AddButton(161, 66, AUTO_HALLWAY_BUTTON, "Hallway");
  354.     AddButton(247, 66, AUTO_OPENAREA_BUTTON, "OpenArea");
  355.     AddButton(161, 83, AUTO_TUNNEL_BUTTON, "Tunnel");
  356.     AddButton(255, 83, AUTO_CHAMBER_BUTTON, "Chamber");
  357.     EndEffect();
  358.     fi;
  359.     CallEffect(nil, ADD_AUTO_KIND_BUTTONS_ID);
  360. corp;
  361.  
  362. /*
  363.  * addObjectButtons - add the buttons for making objects.
  364.  */
  365.  
  366. define tp_build2 ADD_OBJECT_BUTTONS_ID NextEffectId().
  367. define tp_build2 proc utility addObjectButtons()void:
  368.  
  369.     if not KnowsEffect(nil, ADD_OBJECT_BUTTONS_ID) then
  370.     DefineEffect(nil, ADD_OBJECT_BUTTONS_ID);
  371.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  372.     AddButton(216, 32, NEW_BUTTON, "New");
  373.     AddButton(263, 32, SELECT_BUTTON, "Select");
  374.     AddButton(161, 49, DESC_BUTTON, "Desc");
  375.     AddButton(203, 49, NAME_BUTTON, "Name");
  376.     AddButton(245, 49, ACT_BUTTON, "Act");
  377.     AddButton(279, 49, CONTAINER_BUTTON, "Cont");
  378.     AddButton(161, 66, GET_BUTTON, "Get");
  379.     AddButton(195, 66, LIGHT_BUTTON, "Lite");
  380.     AddButton(237, 66, INVIS_BUTTON, "Invis");
  381.     AddButton(287, 66, POS_BUTTON, "Pos");
  382.     AddButton(161, 83, ACTWORD_BUTTON, "ActWord");
  383.     AddButton(239, 83, ACTSTRING_BUTTON, "ActString");
  384.     EndEffect();
  385.     fi;
  386.     CallEffect(nil, ADD_OBJECT_BUTTONS_ID);
  387. corp;
  388.  
  389. /*
  390.  * addPositionButtons - add the buttons for object character positions.
  391.  */
  392.  
  393. define tp_build2 ADD_POSITION_BUTTONS_ID NextEffectId().
  394. define tp_build2 proc utility addPositionButtons()void:
  395.  
  396.     if not KnowsEffect(nil, ADD_POSITION_BUTTONS_ID) then
  397.     DefineEffect(nil, ADD_POSITION_BUTTONS_ID);
  398.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  399.     AddButton(204, 32, SIT_IN_BUTTON, "Sit In");
  400.     AddButton(263, 32, SIT_ON_BUTTON, "Sit On");
  401.     AddButton(161, 49, LIE_IN_BUTTON, "Lie In");
  402.     AddButton(263, 49, LIE_ON_BUTTON, "Lie On");
  403.     AddButton(161, 66, STAND_IN_BUTTON, "Stand In");
  404.     AddButton(247, 66, STAND_ON_BUTTON, "Stand On");
  405.     EndEffect();
  406.     fi;
  407.     CallEffect(nil, ADD_POSITION_BUTTONS_ID);
  408. corp;
  409.  
  410. /*
  411.  * addObjectActionButtons - add the action word buttons.
  412.  */
  413.  
  414. define tp_build2 ADD_OBJECT_ACTION_BUTTONS1_ID NextEffectId().
  415. define tp_build2 proc utility addObjectActionButtons1()void:
  416.  
  417.     if not KnowsEffect(nil, ADD_OBJECT_ACTION_BUTTONS1_ID) then
  418.     DefineEffect(nil, ADD_OBJECT_ACTION_BUTTONS1_ID);
  419.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  420.     AddButton(224, 32, GET_BUTTON, "Get");
  421.     AddButton(279, 32, MORE_BUTTON, "MORE");
  422.     AddButton(161, 49, PLAY_BUTTON, "Play");
  423.     AddButton(220, 49, ERASE_BUTTON, "Erase");
  424.     AddButton(287, 49, EAT_BUTTON, "Eat");
  425.     AddButton(161, 66, READ_BUTTON, "Read");
  426.     AddButton(216, 66, OPEN_BUTTON, "Open");
  427.     AddButton(271, 66, CLOSE_BUTTON, "Close");
  428.     AddButton(161, 83, TURN_BUTTON, "Turn");
  429.     AddButton(224, 83, LIFT_BUTTON, "Lift");
  430.     AddButton(287, 83, USE_BUTTON, "Use");
  431.     EndEffect();
  432.     fi;
  433.     CallEffect(nil, ADD_OBJECT_ACTION_BUTTONS1_ID);
  434. corp;
  435.  
  436. define tp_build2 ADD_OBJECT_ACTION_BUTTONS2_ID NextEffectId().
  437. define tp_build2 proc utility addObjectActionButtons2()void:
  438.  
  439.     if not KnowsEffect(nil, ADD_OBJECT_ACTION_BUTTONS2_ID) then
  440.     DefineEffect(nil, ADD_OBJECT_ACTION_BUTTONS2_ID);
  441.     AddButton(161, 32, EXIT_BUTTON, "EXIT");
  442.     AddButton(212, 32, UNLOCK_BUTTON, "Unlock");
  443.     AddButton(279, 32, MORE_BUTTON, "MORE");
  444.     AddButton(161, 49, ACTIVATE_BUTTON, "Activate");
  445.     AddButton(263, 49, LISTEN_BUTTON, "Listen");
  446.     AddButton(161, 66, WEAR_BUTTON, "Wear");
  447.     AddButton(220, 66, PUSH_BUTTON, "Push");
  448.     AddButton(279, 66, PULL_BUTTON, "Pull");
  449.     AddButton(161, 83, LOWER_BUTTON, "Lower");
  450.     AddButton(216, 83, TOUCH_BUTTON, "Touch");
  451.     AddButton(271, 83, SMELL_BUTTON, "Smell");
  452.     EndEffect();
  453.     fi;
  454.     CallEffect(nil, ADD_OBJECT_ACTION_BUTTONS2_ID);
  455. corp;
  456.  
  457. /*
  458.  * roomNameHandler - final step of creating a new room.
  459.  */
  460.  
  461. define tp_build2 proc utility roomNameHandler(string s; bool ok)void:
  462.     thing me;
  463.  
  464.     me := Me();
  465.     if ok then
  466.     doCreateRoom(me@p_pSelectedDir, me@p_pRoomKind, s);
  467.     AutoRedraw();
  468.     else
  469.     Print("Room creation cancelled.\n");
  470.     fi;
  471.     me -- p_pRoomKind;
  472.     me -- p_pSelectedDir;
  473.     addRoomButtons1();
  474.     me@p_pButtonEraser := EraseAllButtons;
  475. corp;
  476.  
  477. /*
  478.  * roomKindHandler - handler for the user selecting a new room kind.
  479.  */
  480.  
  481. define tp_build2 proc utility roomKindHandler(int whichButton)void:
  482.     thing me;
  483.  
  484.     me := Me();
  485.     me@p_pRoomKind := whichButton - INDOORS_BUTTON;
  486.     ClearButtons();
  487.     ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  488.     me -- p_pHandlerSave5;
  489.     me -- p_pDirectionRoom1;
  490.     GetString("", roomNameHandler, "Name of room, e.g. 'in the pawnshop':");
  491. corp;
  492.  
  493. /*
  494.  * newRoom - called when the user selects a direction for a new room.
  495.  */
  496.  
  497. define tp_build2 proc utility newRoom()void:
  498.     thing me;
  499.  
  500.     me := Me();
  501.     if Here()@(DirProp(me@p_pSelectedDir)) ~= nil then
  502.     Print("That direction is already in use.\n");
  503.     me -- p_pSelectedDir;
  504.     addRoomButtons1();
  505.     me@p_pButtonEraser := EraseAllButtons;
  506.     ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  507.     me -- p_pHandlerSave5;
  508.     me -- p_pDirectionRoom1;
  509.     else
  510.     addRoomKindButtons();
  511.     me@p_pButtonEraser := EraseAllButtons;
  512.     ignore SetCharacterButtonAction(roomKindHandler);
  513.     fi;
  514. corp;
  515.  
  516. /*
  517.  * directionHandler - handler for buttons when getting a direction.
  518.  */
  519.  
  520. define tp_build2 proc utility directionHandler(int whichButton)void:
  521.     thing me;
  522.     int dir;
  523.     action a;
  524.  
  525.     me := Me();
  526.     if whichButton = EXIT_BUTTON then
  527.     eraseDirButtons();
  528.     if me@p_pDirectionRoom1 then
  529.         addRoomButtons1();
  530.         me@p_pButtonEraser := EraseAllButtons;
  531.     else
  532.         addRoomButtons2();
  533.         me@p_pButtonEraser := EraseAllButtons;
  534.     fi;
  535.     me -- p_pDirectionRoom1;
  536.     ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  537.     me -- p_pHandlerSave5;
  538.     me -- p_pDirectionNext;
  539.     me -- p_pDirectionWhat;
  540.     elif whichButton = HELP_BUTTON then
  541.     Print("Select direction for " + me@p_pDirectionWhat + ".\n");
  542.     else
  543.     case whichButton
  544.     incase NW_BUTTON:
  545.         dir := D_NORTHWEST;
  546.     incase N_BUTTON:
  547.         dir := D_NORTH;
  548.     incase NE_BUTTON:
  549.         dir := D_NORTHEAST;
  550.     incase W_BUTTON:
  551.         dir := D_WEST;
  552.     incase E_BUTTON:
  553.         dir := D_EAST;
  554.     incase SW_BUTTON:
  555.         dir := D_SOUTHWEST;
  556.     incase S_BUTTON:
  557.         dir := D_SOUTH;
  558.     incase SE_BUTTON:
  559.         dir := D_SOUTHEAST;
  560.     incase D_BUTTON:
  561.         dir := D_DOWN;
  562.     incase U_BUTTON:
  563.         dir := D_UP;
  564.     incase I_BUTTON:
  565.         dir := D_ENTER;
  566.     incase O_BUTTON:
  567.         dir := D_EXIT;
  568.     esac;
  569.     me@p_pSelectedDir := dir;
  570.     me -- p_pDirectionWhat;
  571.     a := me@p_pDirectionNext;
  572.     me -- p_pDirectionNext;
  573.     eraseDirButtons();
  574.     if a ~= newRoom then
  575.         if me@p_pDirectionRoom1 then
  576.         addRoomButtons1();
  577.         me@p_pButtonEraser := EraseAllButtons;
  578.         else
  579.         addRoomButtons2();
  580.         me@p_pButtonEraser := EraseAllButtons;
  581.         fi;
  582.         me -- p_pDirectionRoom1;
  583.         ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  584.         me -- p_pHandlerSave5;
  585.     fi;
  586.     call(a, void)();
  587.     fi;
  588. corp;
  589.  
  590. /*
  591.  * getDirection - get a direction as part of a room building command.
  592.  */
  593.  
  594. define tp_build2 proc utility getDirection(action nextStep; string what;
  595.     bool room1)void:
  596.     thing me;
  597.  
  598.     me := Me();
  599.     me@p_pDirectionNext := nextStep;
  600.     me@p_pDirectionWhat := what;
  601.     me@p_pDirectionRoom1 := room1;
  602.     ClearButtons();
  603.     addDirButtons();
  604.     me@p_pHandlerSave5 := SetCharacterButtonAction(directionHandler);
  605.     me@p_pButtonEraser := eraseDirButtons;
  606. corp;
  607.  
  608. /*
  609.  * renameRoom - handler for supplying a new room name.
  610.  */
  611.  
  612. define tp_build2 proc utility renameRoom(string name; bool ok)void:
  613.  
  614.     if ok then
  615.     Here()@p_rName := name;
  616.     Print("New name entered.\n");
  617.     else
  618.     Print("Name not changed.\n");
  619.     fi;
  620. corp;
  621.  
  622. /*
  623.  * makeLinkHandler - attempt to link to named room.
  624.  */
  625.  
  626. define tp_build2 proc utility makeLinkHandler(string symbol; bool ok)void:
  627.  
  628.     if ok then
  629.     ignore doMakeLink(symbol, Me()@p_pSelectedDir);
  630.     Me() -- p_pSelectedDir;
  631.     AutoRedraw();
  632.     else
  633.     Print("No link made.\n");
  634.     fi;
  635. corp;
  636.  
  637. /*
  638.  * makeLink - called when the user selects a direction for a new link.
  639.  */
  640.  
  641. define tp_build2 proc utility makeLink()void:
  642.  
  643.     if Here()@(DirProp(Me()@p_pSelectedDir)) ~= nil then
  644.     Print("That direction is already in use.\n");
  645.     Me() -- p_pSelectedDir;
  646.     else
  647.     GetString("", makeLinkHandler, "Enter symbol of room to link to:");
  648.     fi;
  649. corp;
  650.  
  651. /*
  652.  * deleteLink - called when the user selects a direction to delete a link from.
  653.  */
  654.  
  655. define tp_build2 proc utility deleteLink()void:
  656.  
  657.     ignore brv_unlink(ExitName(Me()@p_pSelectedDir));
  658.     Me() -- p_pSelectedDir;
  659.     AutoRedraw();
  660. corp;
  661.  
  662. /*
  663.  * linkSame2 - second part of duplicating a link.
  664.  */
  665.  
  666. define tp_build2 proc utility linkSame2()void:
  667.     thing me, here;
  668.     int newDir;
  669.  
  670.     me := Me();
  671.     here := Here();
  672.     newDir := me@p_pSelectedDir;
  673.     if here@(DirProp(newDir)) ~= nil then
  674.     Print("That new direction is already in use.\n");
  675.     else
  676.     UniConnect(here, here@(DirProp(me@p_pFirstDir)), newDir);
  677.     Print("Link made.\n");
  678.     AutoRedraw();
  679.     changeDone("made a new link");
  680.     fi;
  681.     me -- p_pSelectedDir;
  682.     me -- p_pFirstDir;
  683. corp;
  684.  
  685. /*
  686.  * linkSame1 - called when the user selects a direction whose link is to be
  687.  *    copied to another direction.
  688.  */
  689.  
  690. define tp_build2 proc utility linkSame1()void:
  691.     thing me;
  692.  
  693.     me := Me();
  694.     if Here()@(DirProp(me@p_pSelectedDir)) = nil then
  695.     Print("That old direction does not go anywhere.\n");
  696.     me -- p_pSelectedDir;
  697.     else
  698.     me@p_pFirstDir := me@p_pSelectedDir;
  699.     getDirection(linkSame2, "new link", true);
  700.     fi;
  701. corp;
  702.  
  703. /*
  704.  * autoKindHandler - handler for picking autographics kind.
  705.  */
  706.  
  707. define tp_build2 proc utility autoKindHandler(int whichButton)void:
  708.     thing here, me;
  709.  
  710.     here := Here();
  711.     me := Me();
  712.     case whichButton
  713.     incase EXIT_BUTTON:
  714.     ClearButtons();
  715.     addAutoButtons();
  716.     ignore SetCharacterButtonAction(me@p_pHandlerSave6);
  717.     me -- p_pHandlerSave6;
  718.     me@p_pButtonEraser := EraseAllButtons;
  719.     incase AUTO_ROAD_BUTTON:
  720.     AutoGraphics(here, AutoRoads);
  721.     incase AUTO_PATH_BUTTON:
  722.     AutoGraphics(here, AutoPaths);
  723.     incase AUTO_HALLROOM_BUTTON:
  724.     AutoGraphics(here, AutoOpenRoom);
  725.     incase AUTO_DOORROOM_BUTTON:
  726.     AutoGraphics(here, AutoClosedRoom);
  727.     incase AUTO_HALLWAY_BUTTON:
  728.     AutoGraphics(here, AutoHalls);
  729.     incase AUTO_OPENAREA_BUTTON:
  730.     AutoGraphics(here, AutoOpenSpace);
  731.     incase AUTO_TUNNEL_BUTTON:
  732.     AutoGraphics(here, AutoTunnels);
  733.     incase AUTO_CHAMBER_BUTTON:
  734.     AutoGraphics(here, AutoTunnelChamber);
  735.     esac;
  736.     if whichButton ~= EXIT_BUTTON then
  737.     Print("Autographics entered.\n");
  738.     AutoRedraw();
  739.     fi;
  740. corp;
  741.  
  742. /*
  743.  * colourHandler - handler user choice of a new colour.
  744.  */
  745.  
  746. define tp_build2 proc utility colourHandler(string name; bool ok)void:
  747.     int colour;
  748.  
  749.     if ok then
  750.     colour := ColourMatch(GetNounPhrase(DummyGrammar, name, 0));
  751.     if colour = -1 then
  752.         Print("Invalid colour name. ");
  753.         ShowKnownColours();
  754.     else
  755.         Here()@(
  756.         case Me()@p_pSelectedPen
  757.         incase AUTO_BGNDPEN_BUTTON:
  758.             p_rBackGroundPen
  759.         incase AUTO_FGNDPEN_BUTTON:
  760.             p_rForeGroundPen
  761.         incase AUTO_EDGEPEN_BUTTON:
  762.             p_rEdgePen
  763.         default:
  764.             p_rDoorPen
  765.         esac) := colour;
  766.         Print("New colour entered.\n");
  767.         AutoRedraw();
  768.     fi;
  769.     else
  770.     Print("No colour entered.\n");
  771.     fi;
  772.     Me() -- p_pSelectedPen;
  773. corp;
  774.  
  775. /*
  776.  * getColour - utility to get an autopen colour.
  777.  */
  778.  
  779. define tp_build2 proc utility getColour(int button)void:
  780.     int oldColour;
  781.  
  782.     oldColour := Here()@(
  783.     case button
  784.     incase AUTO_BGNDPEN_BUTTON:
  785.         p_rBackGroundPen
  786.     incase AUTO_FGNDPEN_BUTTON:
  787.         p_rForeGroundPen
  788.     incase AUTO_EDGEPEN_BUTTON:
  789.         p_rEdgePen
  790.     default:
  791.         p_rDoorPen
  792.     esac);
  793.     Me()@p_pSelectedPen := button;
  794.     GetString(ColourName(oldColour), colourHandler,
  795.     "Enter name of new colour:");
  796. corp;
  797.  
  798. /*
  799.  * roomName1Handler - handler for entering first part of name.
  800.  */
  801.  
  802. define tp_build2 proc utility roomName1Handler(string n; bool ok)void:
  803.  
  804.     n := Trim(n);
  805.     if ok and n ~= "" then
  806.     Here()@p_rName1 := n;
  807.     Print("Name entered.\n");
  808.     else
  809.     if Here()@p_rName1 = "" then
  810.         Print("Name not entered.\n");
  811.     else
  812.         Here() -- p_rName1;
  813.         Print("Name deleted.\n");
  814.     fi;
  815.     fi;
  816. corp;
  817.  
  818. /*
  819.  * roomName2Handler - handler for entering second part of name.
  820.  */
  821.  
  822. define tp_build2 proc utility roomName2Handler(string n; bool ok)void:
  823.  
  824.     n := Trim(n);
  825.     if ok and n ~= "" then
  826.     Here()@p_rName2 := n;
  827.     Print("Name entered.\n");
  828.     else
  829.     if Here()@p_rName2 = "" then
  830.         Print("Name not entered.\n");
  831.     else
  832.         Here() -- p_rName2;
  833.         Print("Name deleted.\n");
  834.     fi;
  835.     fi;
  836. corp;
  837.  
  838. /*
  839.  * autoHandler - handle an autographics button hit.
  840.  */
  841.  
  842. define tp_build2 proc utility autoHandler(int whichButton)void:
  843.     thing me, here;
  844.  
  845.     me := Me();
  846.     here := Here();
  847.     case whichButton
  848.     incase EXIT_BUTTON:
  849.     ClearButtons();
  850.     addRoomButtons1();
  851.     ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  852.     me -- p_pHandlerSave5;
  853.     me@p_pButtonEraser := EraseAllButtons;
  854.     incase AUTO_KIND_BUTTON:
  855.     ClearButtons();
  856.     addAutoKindButtons();
  857.     me@p_pHandlerSave6 := SetCharacterButtonAction(autoKindHandler);
  858.     me@p_pButtonEraser := EraseAllButtons;
  859.     incase AUTO_BGNDPEN_BUTTON:
  860.     incase AUTO_FGNDPEN_BUTTON:
  861.     incase AUTO_EDGEPEN_BUTTON:
  862.     incase AUTO_DOORPEN_BUTTON:
  863.     getColour(whichButton);
  864.     incase AUTO_NAME1_BUTTON:
  865.     GetString(here@p_rName1, roomName1Handler,
  866.         "Enter first or only part of graphics room name:");
  867.     incase AUTO_NAME2_BUTTON:
  868.     GetString(here@p_rName2, roomName2Handler,
  869.         "Enter second part of graphics room name:");
  870.     esac;
  871. corp;
  872.  
  873. /*
  874.  * endSetDirDesc - handler after edit of direction description.
  875.  */
  876.  
  877. define tp_build2 proc utility endSetDirDesc(string s)void:
  878.     thing me, here;
  879.     int dir;
  880.  
  881.     me := Me();
  882.     here := Here();
  883.     dir := me@p_pSelectedDir;
  884.     s := Trim(s);
  885.     if s = "" then
  886.     case me@p_pDescKind
  887.     incase DESC_DIRDESC:
  888.         here -- DirDesc(dir);
  889.         Print("Direction description deleted.\n");
  890.     incase DESC_DIRMESSAGE:
  891.         here -- DirMessage(dir);
  892.         Print("Direction message deleted.\n");
  893.     incase DESC_DIROMESSAGE:
  894.         here -- DirOMessage(dir);
  895.         Print("Direction message deleted.\n");
  896.     incase DESC_DIREMESSAGE:
  897.         here -- DirEMessage(dir);
  898.         Print("Direction message deleted.\n");
  899.     esac;
  900.     else
  901.     case me@p_pDescKind
  902.     incase DESC_DIRDESC:
  903.         here@(DirDesc(dir)) := s;
  904.         Print("Direction decorated.\n");
  905.     incase DESC_DIRMESSAGE:
  906.         here@(DirMessage(dir)) := s;
  907.         Print("Direction message entered.\n");
  908.     incase DESC_DIROMESSAGE:
  909.         here@(DirOMessage(dir)) := s;
  910.         Print("Direction message entered.\n");
  911.     incase DESC_DIREMESSAGE:
  912.         here@(DirEMessage(dir)) := s;
  913.         Print("Direction message entered.\n");
  914.     esac;
  915.     fi;
  916.     me -- p_pSelectedDir;
  917.     me -- p_pDescKind;
  918.     changeDone("done some detailing");
  919. corp;
  920.  
  921. /*
  922.  * setDirDesc - set one of the direction descriptions in the room.
  923.  */
  924.  
  925. define tp_build2 proc utility setDirDesc()void:
  926.     int dir;
  927.     thing here;
  928.  
  929.     dir := Me()@p_pSelectedDir;
  930.     here := Here();
  931.     case Me()@p_pDescKind
  932.     incase DESC_DIRDESC:
  933.     ignore GetDocument("room dirdesc> ", "Enter direction description",
  934.         here@(DirDesc(dir)), endSetDirDesc, false);
  935.     incase DESC_DIRMESSAGE:
  936.     ignore GetDocument("room dirmessage> ", "Enter direction message",
  937.         here@(DirMessage(dir)), endSetDirDesc, false);
  938.     incase DESC_DIROMESSAGE:
  939.     ignore GetDocument("room diromessage> ",
  940.         "Enter entering direction message",
  941.         here@(DirOMessage(dir)), endSetDirDesc, false);
  942.     incase DESC_DIREMESSAGE:
  943.     ignore GetDocument("room diremessage> ",
  944.         "Enter exiting direction message",
  945.         here@(DirEMessage(dir)), endSetDirDesc, false);
  946.     esac;
  947. corp;
  948.  
  949. /*
  950.  * sellHandler2 - second step in making something for sale here.
  951.  */
  952.  
  953. define tp_build2 proc utility sellHandler2(string s; bool ok)void:
  954.     thing th;
  955.     int price;
  956.  
  957.     if ok then
  958.     price := StringToPosInt(s);
  959.     if price <= 0 then
  960.         Print("Invalid price.\n");
  961.     else
  962.         th := Me()@p_pSelectedObject;
  963.         AddObjectForSale(Here(), th, price, nil);
  964.         Print(FormatName(th@p_oName) + " is now for sale here.\n");
  965.     fi;
  966.     else
  967.     Print("Nothing added for sale.\n");
  968.     fi;
  969.     Me() -- p_pSelectedObject;
  970. corp;
  971.  
  972. /*
  973.  * sellHandler1 - first step in making something for sale here.
  974.  */
  975.  
  976. define tp_build2 proc utility sellHandler1(string symbol; bool ok)void:
  977.     thing th;
  978.  
  979.     if ok then
  980.     th := objNameCheck(symbol);
  981.     if th ~= nil then
  982.         Me()@p_pSelectedObject := th;
  983.         GetString("0", sellHandler2, "Enter price in blutos:");
  984.     fi;
  985.     else
  986.     Print("Nothing added for sale.\n");
  987.     fi;
  988. corp;
  989.  
  990. /*
  991.  * hideLink - called when the user selects a direction to make hidden.
  992.  */
  993.  
  994. define tp_build2 proc utility hideLink()void:
  995.     list int exits;
  996.     int dir;
  997.  
  998.     exits := Here()@p_rExits;
  999.     dir := Me()@p_pSelectedDir;
  1000.     Me() -- p_pSelectedDir;
  1001.     if Here()@(DirProp(dir)) = nil then
  1002.     Print("There is no link in that direction.\n");
  1003.     elif FindElement(exits, dir) = -1 then
  1004.     AddTail(exits, dir);
  1005.     Print("Link unhidden.\n");
  1006.     AutoRedraw();
  1007.     else
  1008.     DelElement(exits, dir);
  1009.     Print("Link hidden.\n");
  1010.     AutoRedraw();
  1011.     fi;
  1012. corp;
  1013.  
  1014. /*
  1015.  * roomHandler - handler for room building button hits.
  1016.  */
  1017.  
  1018. define tp_build2 proc utility roomHandler2(int whichButton)void:
  1019.     thing me, here;
  1020.     string s;
  1021.  
  1022.     me := Me();
  1023.     here := Here();
  1024.     if whichButton ~= EXIT_BUTTON and whichButton ~= MORE_BUTTON and
  1025.     not Mine(here) and MeCharacter() ~= SysAdmin and
  1026.     (GetThingStatus(here) = ts_readonly or
  1027.      GetThingStatus(here) = ts_wizard and not IsWizard())
  1028.     then
  1029.     Print("The owner of this room has not permitted it.\n");
  1030.     else
  1031.     case whichButton
  1032.     incase EXIT_BUTTON:
  1033.         ClearButtons();
  1034.         addTopButtons();
  1035.         ignore SetCharacterButtonAction(me@p_pHandlerSave3);
  1036.         me -- p_pHandlerSave3;
  1037.         me -- p_pHandlerSave4;
  1038.         me@p_pButtonEraser := EraseAllButtons;
  1039.     incase MORE_BUTTON:
  1040.         ClearButtons();
  1041.         addRoomButtons1();
  1042.         ignore SetCharacterButtonAction(me@p_pHandlerSave4);
  1043.         me -- p_pHandlerSave4;
  1044.         me@p_pButtonEraser := EraseAllButtons;
  1045.     incase DARK_BUTTON:
  1046.         if here@p_rDark then
  1047.         ignore brv_dark("no");
  1048.         else
  1049.         ignore brv_dark("yes");
  1050.         fi;
  1051.     incase LOCK_BUTTON:
  1052.         if here@p_rLocked then
  1053.         ignore brv_lock("no");
  1054.         else
  1055.         ignore brv_lock("yes");
  1056.         fi;
  1057.     incase READONLY_BUTTON:
  1058.         if GetThingStatus(here) = ts_readonly then
  1059.         Print("This room is already read-only.\n");
  1060.         else
  1061.         SetThingStatus(here, ts_readonly);
  1062.         Print("This room is now changeable by its owner only.\n");
  1063.         fi;
  1064.     incase WIZARD_BUTTON:
  1065.         if GetThingStatus(here) = ts_wizard then
  1066.         Print("This room is already wizard-only.\n");
  1067.         else
  1068.         SetThingStatus(here, ts_wizard);
  1069.         Print("This room is now changeable by wizards only.\n");
  1070.         fi;
  1071.     incase PUBLIC_BUTTON:
  1072.         if GetThingStatus(here) = ts_public then
  1073.         Print("This room is already public.\n");
  1074.         else
  1075.         SetThingStatus(here, ts_public);
  1076.         Print(
  1077.     "This room is now changeable by wizards, apprentices and builders.\n");
  1078.         fi;
  1079.     incase DD_BUTTON:
  1080.         me@p_pDescKind := DESC_DIRDESC;
  1081.         getDirection(setDirDesc, "specific description", false);
  1082.     incase DM_BUTTON:
  1083.         me@p_pDescKind := DESC_DIRMESSAGE;
  1084.         getDirection(setDirDesc, "character message", false);
  1085.     incase OM_BUTTON:
  1086.         me@p_pDescKind := DESC_DIROMESSAGE;
  1087.         getDirection(setDirDesc, "bystander exit message", false);
  1088.     incase EM_BUTTON:
  1089.         me@p_pDescKind := DESC_DIREMESSAGE;
  1090.         getDirection(setDirDesc, "bystander enter message", false);
  1091.     esac;
  1092.     fi;
  1093. corp;
  1094.  
  1095. define tp_build2 proc utility roomHandler1(int whichButton)void:
  1096.     thing me, here;
  1097.     string s;
  1098.  
  1099.     me := Me();
  1100.     here := Here();
  1101.     if whichButton ~= EXIT_BUTTON and whichButton ~= MORE_BUTTON and
  1102.     not Mine(here) and MeCharacter() ~= SysAdmin and
  1103.     (GetThingStatus(here) = ts_readonly or
  1104.      GetThingStatus(here) = ts_wizard and not IsWizard())
  1105.     then
  1106.     Print("The owner of this room has not permitted it.\n");
  1107.     else
  1108.     case whichButton
  1109.     incase EXIT_BUTTON:
  1110.         ClearButtons();
  1111.         addTopButtons();
  1112.         ignore SetCharacterButtonAction(me@p_pHandlerSave3);
  1113.         me -- p_pHandlerSave3;
  1114.         me@p_pButtonEraser := EraseAllButtons;
  1115.     incase MORE_BUTTON:
  1116.         ClearButtons();
  1117.         addRoomButtons2();
  1118.         me@p_pHandlerSave4 := SetCharacterButtonAction(roomHandler2);
  1119.         me@p_pButtonEraser := EraseAllButtons;
  1120.     incase NEW_BUTTON:
  1121.         getDirection(newRoom, "new room", true);
  1122.     incase LINK_BUTTON:
  1123.         getDirection(makeLink, "new link", true);
  1124.     incase UNLINK_BUTTON:
  1125.         getDirection(deleteLink, "link to delete", true);
  1126.     incase SAME_BUTTON:
  1127.         getDirection(linkSame1, "old link", true);
  1128.     incase HIDE_BUTTON:
  1129.         getDirection(hideLink, "link to hide", true);
  1130.     incase SHOP_BUTTON:
  1131.         ignore brv_makestore();
  1132.     incase SELL_BUTTON:
  1133.         if not Mine(here) then
  1134.         Print("Can only modify your own stores.\n");
  1135.         elif here@p_rBuyAction ~= StoreBuy then
  1136.         Print("This room is not a store.\n");
  1137.         else
  1138.         /* default to the 'current' object */
  1139.         s := "";
  1140.         if me@p_pCurrentObject ~= nil then
  1141.             s := FindThingSymbol(PrivateTable(), me@p_pCurrentObject);
  1142.         fi;
  1143.         GetString(s, sellHandler1, "Symbol for object to sell here?");
  1144.         fi;
  1145.     incase BANK_BUTTON:
  1146.         ignore brv_makebank();
  1147.     incase DESC_BUTTON:
  1148.         ignore brv_newdesc();
  1149.     incase AUTO_BUTTON:
  1150.         ClearButtons();
  1151.         addAutoButtons();
  1152.         me@p_pHandlerSave5 := SetCharacterButtonAction(autoHandler);
  1153.         me@p_pButtonEraser := EraseAllButtons;
  1154.     incase NAME_BUTTON:
  1155.         GetString(here@p_rName, renameRoom,
  1156.         "Name of room, e.g. 'in the pawnshop':");
  1157.  
  1158.     esac;
  1159.     fi;
  1160. corp;
  1161.  
  1162. /*
  1163.  * newObjectHandler2 - second step in creating a new object.
  1164.  */
  1165.  
  1166. define tp_build2 proc utility newObjectHandler2(string name; bool ok)void:
  1167.     thing me;
  1168.  
  1169.     me := Me();
  1170.     if ok then
  1171.     ignore createNewObject(name, me@p_pCurrentTable, me@p_pSelectedSymbol);
  1172.     else
  1173.     Print("No object created.\n");
  1174.     fi;
  1175.     me -- p_pSelectedSymbol;
  1176. corp;
  1177.  
  1178. /*
  1179.  * newObjectHandler1 - first step in creating a new object.
  1180.  */
  1181.  
  1182. define tp_build2 proc utility newObjectHandler1(string symbol; bool ok)void:
  1183.  
  1184.     if ok then
  1185.     if IsDefined(Me()@p_pCurrentTable, symbol) then
  1186.         Print("Symbol \"" + symbol + "\" is already defined.\n");
  1187.     else
  1188.         Me()@p_pSelectedSymbol := symbol;
  1189.         GetString("", newObjectHandler2,
  1190.         "Object name, eg. 'vase;blue,glass'?");
  1191.     fi;
  1192.     else
  1193.     Print("No object created.\n");
  1194.     fi;
  1195. corp;
  1196.  
  1197. /*
  1198.  * selectObjectHandler - select a new current object.
  1199.  */
  1200.  
  1201. define tp_build2 proc utility selectObjectHandler(string symbol; bool ok)void:
  1202.     thing th;
  1203.  
  1204.     if ok then
  1205.     th := objNameCheck(symbol);
  1206.     if th ~= nil then
  1207.         Me()@p_pCurrentObject := th;
  1208.         Print("'" + symbol + "' is now the current object.\n");
  1209.     fi;
  1210.     else
  1211.     Print("Current object not changed.\n");
  1212.     fi;
  1213. corp;
  1214.  
  1215. /*
  1216.  * nameObjectHandler - give a new name to the object.
  1217.  */
  1218.  
  1219. define tp_build2 proc utility nameObjectHandler(string name; bool ok)void:
  1220.  
  1221.     if ok then
  1222.     Me()@p_pCurrentObject@p_oName := name;
  1223.     Print("Object renamed.\n");
  1224.     else
  1225.     Print("Object not renamed.\n");
  1226.     fi;
  1227. corp;
  1228.  
  1229. /*
  1230.  * actionsHandler - handler for button picks on special actions.
  1231.  */
  1232.  
  1233. define tp_build2 proc utility actions2Handler(int whichButton)void:
  1234.     thing me;
  1235.  
  1236.     me := Me();
  1237.     if whichButton = EXIT_BUTTON then
  1238.     ClearButtons();
  1239.     addObjectButtons();
  1240.     ignore SetCharacterButtonAction(me@p_pHandlerSave4);
  1241.     me -- p_pHandlerSave4;
  1242.     me -- p_pHandlerSave5;
  1243.     me@p_pButtonEraser := EraseAllButtons;
  1244.     elif whichButton = MORE_BUTTON then
  1245.     ClearButtons();
  1246.     addObjectActionButtons1();
  1247.     ignore SetCharacterButtonAction(me@p_pHandlerSave5);
  1248.     me -- p_pHandlerSave5;
  1249.     me@p_pButtonEraser := EraseAllButtons;
  1250.     else
  1251.     ignore doSetVerbString(
  1252.         case whichButton
  1253.         incase UNLOCK_BUTTON:
  1254.         "unlock"
  1255.         incase ACTIVATE_BUTTON:
  1256.         "activate"
  1257.         incase LISTEN_BUTTON:
  1258.         "listen"
  1259.         incase WEAR_BUTTON:
  1260.         "wear"
  1261.         incase PUSH_BUTTON:
  1262.         "push"
  1263.         incase PULL_BUTTON:
  1264.         "pull"
  1265.         incase LOWER_BUTTON:
  1266.         "lower"
  1267.         incase TOUCH_BUTTON:
  1268.         "touch"
  1269.         incase SMELL_BUTTON:
  1270.         "smell"
  1271.         default:
  1272.         "???"
  1273.         esac, me@p_pCurrentObject);
  1274.     fi;
  1275. corp;
  1276.  
  1277. define tp_build2 proc utility actions1Handler(int whichButton)void:
  1278.     thing me;
  1279.  
  1280.     me := Me();
  1281.     if whichButton = EXIT_BUTTON then
  1282.     ClearButtons();
  1283.     addObjectButtons();
  1284.     ignore SetCharacterButtonAction(me@p_pHandlerSave4);
  1285.     me -- p_pHandlerSave4;
  1286.     me@p_pButtonEraser := EraseAllButtons;
  1287.     elif whichButton = MORE_BUTTON then
  1288.     ClearButtons();
  1289.     addObjectActionButtons2();
  1290.     me@p_pHandlerSave5 := SetCharacterButtonAction(actions2Handler);
  1291.     me@p_pButtonEraser := EraseAllButtons;
  1292.     elif whichButton = READ_BUTTON then
  1293.     ignore doObjectRead(me@p_pCurrentObject);
  1294.     else
  1295.     ignore doSetVerbString(
  1296.         case whichButton
  1297.         incase GET_BUTTON:
  1298.         "get"
  1299.         incase PLAY_BUTTON:
  1300.         "play"
  1301.         incase ERASE_BUTTON:
  1302.         "erase"
  1303.         incase EAT_BUTTON:
  1304.         "eat"
  1305.         incase OPEN_BUTTON:
  1306.         "open"
  1307.         incase CLOSE_BUTTON:
  1308.         "close"
  1309.         incase TURN_BUTTON:
  1310.         "turn"
  1311.         incase LIFT_BUTTON:
  1312.         "lift"
  1313.         incase USE_BUTTON:
  1314.         "use"
  1315.         default:
  1316.         "???"
  1317.         esac, me@p_pCurrentObject);
  1318.     fi;
  1319. corp;
  1320.  
  1321. /*
  1322.  * capacityHandler - set a new capacity on a container.
  1323.  */
  1324.  
  1325. define tp_build2 proc utility capacityHandler(string s; bool ok)void:
  1326.     thing object;
  1327.     int n;
  1328.  
  1329.     object := Me()@p_pCurrentObject;
  1330.     if ok then
  1331.     n := StringToPosInt(s);
  1332.     if n < 0 then
  1333.         Print("Invalid capacity.\n");
  1334.     elif n = 0 then
  1335.         if object@p_oContents ~= nil then
  1336.         object -- p_oContents;
  1337.         object -- p_oCapacity;
  1338.         Print("Current object marked as not being a container.\n");
  1339.         else
  1340.         Print("Current object not marked as being a container.\n");
  1341.         fi;
  1342.     else
  1343.         if object@p_oContents ~= nil then
  1344.         Print("Capacity set.\n");
  1345.         else
  1346.         object@p_oContents := CreateThingList();
  1347.         Print("Current object marked as being a container.\n");
  1348.         fi;
  1349.         object@p_oCapacity := n;
  1350.     fi;
  1351.     else
  1352.     if object@p_oContents ~= nil then
  1353.         Print("Capacity not changed.\n");
  1354.     else
  1355.         Print("Current object not marked as being a container.\n");
  1356.     fi;
  1357.     fi;
  1358. corp;
  1359.  
  1360. /*
  1361.  * routines for dealing with positions characters can occupy WRT objects.
  1362.  */
  1363.  
  1364. define tp_build2 proc utility positionCountHandler(string s; bool ok)void:
  1365.     thing object;
  1366.     int n;
  1367.     property int prop;
  1368.  
  1369.     if ok then
  1370.     object := Me()@p_pCurrentObject;
  1371.     prop := PositionProp(Me()@p_pSelectedDir);
  1372.     n := StringToPosInt(s);
  1373.     if n < 0 then
  1374.         Print("Invalid occupant maximum.\n");
  1375.     elif n = 0 then
  1376.         object -- prop;
  1377.         Print("Occupation capacity removed.\n");
  1378.     else
  1379.         object@(prop) := n + 1;
  1380.         Print("Occupation capacity entered.\n");
  1381.     fi;
  1382.     else
  1383.     Print("Occupation capacity not changed.\n");
  1384.     fi;
  1385.     Me() -- p_pSelectedDir;
  1386. corp;
  1387.  
  1388. define tp_build2 proc utility objectPositionHandler(int whichButton)void:
  1389.     thing me;
  1390.     int valueNow;
  1391.  
  1392.     me := Me();
  1393.     if whichButton = EXIT_BUTTON then
  1394.     ClearButtons();
  1395.     addObjectButtons();
  1396.     ignore SetCharacterButtonAction(me@p_pHandlerSave4);
  1397.     me -- p_pHandlerSave4;
  1398.     me@p_pButtonEraser := EraseAllButtons;
  1399.     else
  1400.     whichButton := whichButton - SIT_IN_BUTTON + POS_SIT_IN;
  1401.     valueNow := me@p_pCurrentObject@(PositionProp(whichButton));
  1402.     if valueNow = 0 then
  1403.         valueNow := 2;
  1404.     fi;
  1405.     me@p_pSelectedDir := whichButton;
  1406.     GetString(IntToString(valueNow - 1), positionCountHandler,
  1407.         "Maximum number of occupants:");
  1408.     fi;
  1409. corp;
  1410.  
  1411. /*
  1412.  * actwordObjectHandler - supply actions words for this object.
  1413.  */
  1414.  
  1415. define tp_build2 proc utility actwordObjectHandler(string s; bool ok)void:
  1416.  
  1417.     if ok then
  1418.     Me()@p_pCurrentObject@p_oActWord := s;
  1419.     Print("Special action words entered.\n");
  1420.     else
  1421.     if Me()@p_pCurrentObject@p_oActWord = "" then
  1422.         Print("No special actions words entered.\n");
  1423.     else
  1424.         Print("Special actions words not changed.\n");
  1425.     fi;
  1426.     fi;
  1427. corp;
  1428.  
  1429. /*
  1430.  * objectHandler - handler for top level object building commands.
  1431.  */
  1432.  
  1433. define tp_build2 proc utility objectHandler(int whichButton)void:
  1434.     thing me, currentObject;
  1435.  
  1436.     me := Me();
  1437.     currentObject := me@p_pCurrentObject;
  1438.     if currentObject = nil and
  1439.     whichButton ~= EXIT_BUTTON and whichButton ~= NEW_BUTTON and
  1440.     whichButton ~= SELECT_BUTTON
  1441.     then
  1442.     Print("You must select an object first.\n");
  1443.     else
  1444.     case whichButton
  1445.     incase EXIT_BUTTON:
  1446.         ClearButtons();
  1447.         addTopButtons();
  1448.         ignore SetCharacterButtonAction(me@p_pHandlerSave3);
  1449.         me -- p_pHandlerSave3;
  1450.         me@p_pButtonEraser := EraseAllButtons;
  1451.     incase NEW_BUTTON:
  1452.         GetString("", newObjectHandler1, "Symbol for new object?");
  1453.     incase SELECT_BUTTON:
  1454.         GetString("", selectObjectHandler, "Object to select?");
  1455.     incase DESC_BUTTON:
  1456.         ignore doObjectDesc(currentObject);
  1457.     incase NAME_BUTTON:
  1458.         GetString(currentObject@p_oName, nameObjectHandler,
  1459.         "New name, eg. 'vase;blue,glass'?");
  1460.     incase ACT_BUTTON:
  1461.         ClearButtons();
  1462.         addObjectActionButtons1();
  1463.         me@p_pHandlerSave4 := SetCharacterButtonAction(actions1Handler);
  1464.         me@p_pButtonEraser := EraseAllButtons;
  1465.     incase CONTAINER_BUTTON:
  1466.         GetString(IntToString(currentObject@p_oCapacity), capacityHandler,
  1467.         "Capacity of object?");
  1468.     incase GET_BUTTON:
  1469.         if currentObject@p_oNotGettable then
  1470.         currentObject -- p_oNotGettable;
  1471.         Print("Current object is now gettable.\n");
  1472.         else
  1473.         currentObject@p_oNotGettable := true;
  1474.         Print("Current object is now not gettable.\n");
  1475.         fi;
  1476.     incase LIGHT_BUTTON:
  1477.         if currentObject@p_oLight then
  1478.         currentObject -- p_oLight;
  1479.         Print("Current object marked as not emitting light.\n");
  1480.         else
  1481.         currentObject@p_oLight := true;
  1482.         Print("Current object marked as emitting light.\n");
  1483.         fi;
  1484.     incase INVIS_BUTTON:
  1485.         if currentObject@p_oInvisible then
  1486.         currentObject -- p_oInvisible;
  1487.         Print("Current object marked as not invisible.\n");
  1488.         else
  1489.         currentObject@p_oInvisible := true;
  1490.         Print("Current object marked as invisible.\n");
  1491.         fi;
  1492.     incase POS_BUTTON:
  1493.         ClearButtons();
  1494.         addPositionButtons();
  1495.         me@p_pHandlerSave4 :=
  1496.         SetCharacterButtonAction(objectPositionHandler);
  1497.         me@p_pButtonEraser := EraseAllButtons;
  1498.     incase ACTWORD_BUTTON:
  1499.         GetString(currentObject@p_oActWord, actwordObjectHandler,
  1500.         "Special act word, eg. 'dust,clean,sweep'?");
  1501.     incase ACTSTRING_BUTTON:
  1502.         ignore enterActString(currentObject);
  1503.     esac;
  1504.     fi;
  1505. corp;
  1506.  
  1507. /*
  1508.  * poofHandler - the poof button
  1509.  */
  1510.  
  1511. define tp_build2 proc utility poofHandler(string symbol; bool ok)void:
  1512.  
  1513.     if ok then
  1514.     ignore bv_poof(symbol);
  1515.     else
  1516.     Print("*Poof* cancelled.\n");
  1517.     fi;
  1518. corp;
  1519.  
  1520. /*
  1521.  * namehereHandler - the name here button
  1522.  */
  1523.  
  1524. define tp_build2 proc utility namehereHandler(string symbol; bool ok)void:
  1525.  
  1526.     if ok then
  1527.     if DefineThing(Me()@p_pCurrentTable, symbol, Here()) then
  1528.         Print("New symbol defined.\n");
  1529.     fi;
  1530.     else
  1531.     Print("No new symbol defined.\n");
  1532.     fi;
  1533. corp;
  1534.  
  1535. /*
  1536.  * newTableHandler - define a new table.
  1537.  */
  1538.  
  1539. define tp_build2 proc utility newTableHandler(string symbol; bool ok)void:
  1540.     thing me;
  1541.     table tb;
  1542.  
  1543.     if ok then
  1544.     me := Me();
  1545.     if IsDefined(me@p_pCurrentTable, symbol) then
  1546.         Print("Symbol already defined.\n");
  1547.     else
  1548.         tb := CreateTable();
  1549.         if DefineTable(me@p_pCurrentTable, symbol, tb) then
  1550.         me@p_pCurrentTable := tb;
  1551.         Print("New table defined and made the current table.\n");
  1552.         fi;
  1553.     fi;
  1554.     else
  1555.     Print("No new table defined.\n");
  1556.     fi;
  1557. corp;
  1558.  
  1559. /*
  1560.  * selectTableHandler - select a table as the current table.
  1561.  */
  1562.  
  1563. define tp_build2 proc utility selectTableHandler(string symbol; bool ok)void:
  1564.     table tb;
  1565.  
  1566.     if ok then
  1567.     if symbol == "private" then
  1568.         Me()@p_pCurrentTable := PrivateTable();
  1569.         Print("Your private table is now the current table.\n");
  1570.     elif symbol == "public" then
  1571.         Me()@p_pCurrentTable := PublicTable();
  1572.         Print("The public table is now the current table.\n");
  1573.     else
  1574.         tb := checkTable(symbol);
  1575.         if tb ~= nil then
  1576.         Me()@p_pCurrentTable := tb;
  1577.         Print("Table '" + symbol + "' is now the current table.\n");
  1578.         fi;
  1579.     fi;
  1580.     else
  1581.     Print("No new table selected.\n");
  1582.     fi;
  1583. corp;
  1584.  
  1585. /*
  1586.  * useTableHandler - use the given table.
  1587.  */
  1588.  
  1589. define tp_build2 proc utility useTableHandler(string symbol; bool ok)void:
  1590.     table tb;
  1591.  
  1592.     if ok then
  1593.     tb := checkTable(symbol);
  1594.     if tb ~= nil then
  1595.         if UseTable(tb) then
  1596.         Print("Table added to in-use list.\n");
  1597.         fi;
  1598.     fi;
  1599.     fi;
  1600. corp;
  1601.  
  1602. /*
  1603.  * unuseTableHandler - unuse the given table.
  1604.  */
  1605.  
  1606. define tp_build2 proc utility unuseTableHandler(string symbol; bool ok)void:
  1607.     table tb;
  1608.  
  1609.     if ok then
  1610.     tb := checkTable(symbol);
  1611.     if tb ~= nil then
  1612.         if UnUseTable(tb) then
  1613.         Print("Table removed from in-use list.\n");
  1614.         fi;
  1615.     fi;
  1616.     fi;
  1617. corp;
  1618.  
  1619. /*
  1620.  * describeHandler - describe the given symbol.
  1621.  */
  1622.  
  1623. define tp_build2 proc utility describeHandler(string symbol; bool ok)void:
  1624.  
  1625.     if ok then
  1626.     DescribeSymbol(Me()@p_pCurrentTable, symbol);
  1627.     fi;
  1628. corp;
  1629.  
  1630. /*
  1631.  * tablesHandler - handler for the tables buttons.
  1632.  */
  1633.  
  1634. define tp_build2 proc utility tablesHandler(int whichButton)void:
  1635.     thing me;
  1636.  
  1637.     me := Me();
  1638.     case whichButton
  1639.     incase EXIT_BUTTON:
  1640.     ClearButtons();
  1641.     addTopButtons();
  1642.     ignore SetCharacterButtonAction(me@p_pHandlerSave3);
  1643.     me -- p_pHandlerSave3;
  1644.     me@p_pButtonEraser := EraseAllButtons;
  1645.     incase NEW_BUTTON:
  1646.     GetString("", newTableHandler, "Symbol for new table?");
  1647.     incase SELECT_BUTTON:
  1648.     GetString("", selectTableHandler, "Table to select?");
  1649.     incase USE_BUTTON:
  1650.     GetString("", useTableHandler, "Table to use?");
  1651.     incase UNUSE_BUTTON:
  1652.     GetString("", unuseTableHandler, "Table to unuse?");
  1653.     incase SYMBOLS_BUTTON:
  1654.     ShowTable(me@p_pCurrentTable);
  1655.     incase DESCRIBE_BUTTON:
  1656.     GetString("", describeHandler, "Symbol to describe?");
  1657.     esac;
  1658. corp;
  1659.  
  1660. /*
  1661.  * topHandler - handler for the top level build choices.
  1662.  */
  1663.  
  1664. define tp_build2 proc utility topHandler(int whichButton)void:
  1665.     thing me;
  1666.  
  1667.     me := Me();
  1668.     case whichButton
  1669.     incase EXIT_BUTTON:
  1670.     ClearButtons();
  1671.     AddStandardButtons();
  1672.     addBuildButton();
  1673.     ignore SetCharacterButtonAction(me@p_pHandlerSave2);
  1674.     me -- p_pHandlerSave2;
  1675.     me@p_pButtonEraser := eraseBuildButton;
  1676.     incase ROOM_BUTTON:
  1677.     ClearButtons();
  1678.     addRoomButtons1();
  1679.     me@p_pHandlerSave3 := SetCharacterButtonAction(roomHandler1);
  1680.     me@p_pButtonEraser := EraseAllButtons;
  1681.     incase OBJECT_BUTTON:
  1682.     ClearButtons();
  1683.     addObjectButtons();
  1684.     me@p_pHandlerSave3 := SetCharacterButtonAction(objectHandler);
  1685.     me@p_pButtonEraser := EraseAllButtons;
  1686.     incase POOF_BUTTON:
  1687.     GetString("", poofHandler, "Symbol of room to *poof* to?");
  1688.     incase SYMBOLHERE_BUTTON:
  1689.     GetString("", namehereHandler, "Symbol to name this room?");
  1690.     incase TABLES_BUTTON:
  1691.     ClearButtons();
  1692.     addTableButtons();
  1693.     me@p_pHandlerSave3 := SetCharacterButtonAction(tablesHandler);
  1694.     me@p_pButtonEraser := EraseAllButtons;
  1695.     esac;
  1696. corp;
  1697.  
  1698. /*
  1699.  * buildButtonHandler - top level handler for the build button.
  1700.  */
  1701.  
  1702. define tp_build2 proc utility buildButtonHandler(int whichButton)void:
  1703.     thing me;
  1704.  
  1705.     me := Me();
  1706.     if whichButton = BUILD_BUTTON then
  1707.     if me@p_pStandardButtonsNow then
  1708.         EraseStandardButtons();
  1709.         EraseButton(BUILD_BUTTON);
  1710.         addTopButtons();
  1711.         me@p_pButtonEraser := EraseAllButtons;
  1712.         me@p_pHandlerSave2 := SetCharacterButtonAction(topHandler);
  1713.         me@p_pStandardButtonsNow := false;
  1714.     fi;
  1715.     else
  1716.     call(me@p_pHandlerSave1, void)(whichButton);
  1717.     fi;
  1718. corp;
  1719.  
  1720. /*
  1721.  * buildIdle - character has build active, then exits game - reset things.
  1722.  */
  1723.  
  1724. define tp_build2 proc utility buildIdle()void:
  1725.     thing me;
  1726.     action a;
  1727.  
  1728.     me := Me();
  1729.     me -- p_pButtonEraser;
  1730.     me -- p_pHandlerSave3;
  1731.     me -- p_pHandlerSave2;
  1732.     /* clear the top level one as well - it is put back on character entry */
  1733.     ignore SetCharacterButtonAction(me@p_pHandlerSave1);
  1734.     me -- p_pHandlerSave1;
  1735.     /* want to do this last, to preserve the stack of idle action calls */
  1736.     a := me@p_pIdleSave;
  1737.     ignore SetCharacterIdleAction(a);
  1738.     me@p_pStandardButtonsNow := true;
  1739.     me -- p_pIdleSave;
  1740.     if a ~= nil then
  1741.     call(a, void)();
  1742.     fi;
  1743. corp;
  1744.  
  1745. /*
  1746.  * setupBuild - setup for mouse building.
  1747.  */
  1748.  
  1749. define tp_build proc utility setupBuild()void:
  1750.     thing me;
  1751.  
  1752.     me := Me();
  1753.     if me@p_pHandlerSave1 = nil then
  1754.     /* could have been nuked out while build enabled */
  1755.     me@p_pCurrentTable := PrivateTable();
  1756.     me@p_pHandlerSave1 := SetCharacterButtonAction(buildButtonHandler);
  1757.     me@p_pIdleSave := SetCharacterIdleAction(buildIdle);
  1758.     me@p_pButtonEraser := eraseBuildButton;
  1759.     fi;
  1760.     addBuildButton();
  1761. corp;
  1762.  
  1763. /*
  1764.  * clearBuild - remove the build buttons - used on exit from playpen.
  1765.  */
  1766.  
  1767. define tp_build proc utility clearBuild()void:
  1768.     thing me;
  1769.     action a;
  1770.  
  1771.     me := Me();
  1772.     a := me@p_pIdleSave;
  1773.     if a ~= nil then
  1774.     /* he could have last exited while in playpen, so would not be set
  1775.        up yet. */
  1776.     ignore SetCharacterIdleAction(a);
  1777.     me -- p_pIdleSave;
  1778.     me -- p_pHandlerSave4;
  1779.     me -- p_pHandlerSave3;
  1780.     me -- p_pHandlerSave2;
  1781.     ignore SetCharacterButtonAction(me@p_pHandlerSave1);
  1782.     me -- p_pHandlerSave1;
  1783.     a := me@p_pButtonEraser;
  1784.     me -- p_pButtonEraser;
  1785.     call(a, void)();
  1786.     if a ~= eraseBuildButton then
  1787.         AddStandardButtons();
  1788.     fi;
  1789.     fi;
  1790. corp;
  1791.  
  1792. /*
  1793.  * checkBuildButton - check for adding the build button. Called when the
  1794.  *    character is starting up.
  1795.  */
  1796.  
  1797. define tp_build proc utility checkBuildButton()void:
  1798.  
  1799.     if Me()@p_pBuilder or Here()@p_rPlayPen then
  1800.     setupBuild();
  1801.     fi;
  1802. corp;
  1803.  
  1804. AddTail(CharacterThing(SysAdmin)@p_pEnterActions, checkBuildButton).
  1805.  
  1806. /*
  1807.  * makebuilder - a spell to make someone a builder.
  1808.  */
  1809.  
  1810. define tp_build2 proc doMakeBuilder()status:
  1811.     list action la;
  1812.  
  1813.     la := Me()@p_pEnterActions;
  1814.     if FindElement(la, checkBuildButton) = -1 then
  1815.     AddTail(la, checkBuildButton);
  1816.     fi;
  1817.     setupBuild();
  1818.     continue
  1819. corp;
  1820.  
  1821. /* This is put into SysAdmin's private table so that he can use it as
  1822.    a spell with "cast". On the V0.5 release it was "public", which meant
  1823.    that ANYONE could cast it! */
  1824.  
  1825. private proc makebuilder()void:
  1826.     string name;
  1827.     character ch;
  1828.     thing th, loc;
  1829.  
  1830.     name := GetWord();
  1831.     if name = "" then
  1832.     Print("makebuilder who?\n");
  1833.     else
  1834.     ch := Character(name);
  1835.     if ch = nil then
  1836.         Print("There is no character called '" + name + "'.\n");
  1837.     else
  1838.         th := CharacterThing(ch);
  1839.         if th@p_pBuilder then
  1840.         Print(name + " is already a builder.\n");
  1841.         else
  1842.         loc := CharacterLocation(ch);
  1843.         if loc ~= nil and not loc@p_rPlayPen then
  1844.             th@p_pBuilder := true;
  1845.             if AgentLocation(th) ~= nil then
  1846.             ignore ForceAction(th, doMakeBuilder);
  1847.             SPrint(th, Me()@p_pName +
  1848.                 " has just made you a builder.\n");
  1849.             fi;
  1850.             Print(name + " is now a builder.\n");
  1851.         else
  1852.             Print("Can't do that right now.\n");
  1853.         fi;
  1854.         fi;
  1855.     fi;
  1856.     fi;
  1857. corp;
  1858.  
  1859. /*
  1860.  * unmakebuilder - a spell to make someone not a builder.
  1861.  */
  1862.  
  1863. define tp_build2 proc doUnmakeBuilder()status:
  1864.  
  1865.     DelElement(Me()@p_pEnterActions, checkBuildButton);
  1866.     clearBuild();
  1867.     continue
  1868. corp;
  1869.  
  1870. private proc unmakebuilder()void:
  1871.     string name;
  1872.     character ch;
  1873.     thing th, loc;
  1874.  
  1875.     name := GetWord();
  1876.     if name = "" then
  1877.     Print("unmakebuilder who?\n");
  1878.     else
  1879.     ch := Character(name);
  1880.     if ch = nil then
  1881.         Print("There is no character called '" + name + "'.\n");
  1882.     else
  1883.         th := CharacterThing(ch);
  1884.         if not th@p_pBuilder then
  1885.         Print(name + " is already not a builder.\n");
  1886.         else
  1887.         loc := CharacterLocation(ch);
  1888.         if loc ~= nil and not loc@p_rPlayPen and
  1889.             th@p_pHandlerSave2 = nil
  1890.         then
  1891.             th@p_pBuilder := false;
  1892.             if AgentLocation(th) ~= nil then
  1893.             ignore ForceAction(th, doUnmakeBuilder);
  1894.             SPrint(th, Me()@p_pName +
  1895.                 " has just made you not a builder.\n");
  1896.             fi;
  1897.             Print(name + " is now not a builder.\n");
  1898.         else
  1899.             Print("Can't do that right now.\n");
  1900.         fi;
  1901.         fi;
  1902.     fi;
  1903.     fi;
  1904. corp;
  1905.  
  1906. unuse tp_build2
  1907.